import request from "@/utils/request";

export function page(data) {
  return request({
    url: '/senddocManage/page',
    method: 'get',
    params: data
  })
}

export function generateArticle(data) {
  return request({
    url: '/senddocManage/generateArticle',
    method: 'post',
    data: data
  })
}

export function saveArticle(data) {
  return request({
    url: '/senddocManage/saveArticle',
    method: 'post',
    data: data
  })
}

export function deleteById(data) {
  return request({
    url: '/senddocManage/deleteByIds?ids='+ data.id,
    method: 'post',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    data: data
  })
}

export function autoGenerateArticle(data) {
  return request({
    url: '/senddocManage/autoGenerateArticle',
    method: 'post',
    data: data
  })
}


export function saveTobeImgList(data) {
  return request({
    url: '/senddocManage/saveTobeImgList',
    method: 'post',
    data: data
  })
}

export function tobeImgPage(data) {
  return request({
    url: '/senddocManage/tobeImgPage',
    method: 'get',
    params: data
  })
}

export function deleteTobeImgByIds(data) {
  return request({
    url: '/senddocManage/deleteTobeImgByIds?ids='+ data.id,
    method: 'post',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    data: data
  })
}


export function createDraft(data) {
  return request({
    url: '/senddocManage/createDraft',
    method: 'post',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    data: data
  })
}

export function selected(data) {
  return request({
    url: '/senddocManage/selected?ids='+ data.id,
    method: 'post',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    data: data
  })
}

export function published(data) {
  return request({
    url: '/senddocManage/published?ids='+ data.id,
    method: 'post',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    data: data
  })
}


export function updateCoverUrl(data) {
  return request({
    url: '/senddocManage/updateCoverUrl',
    method: 'post',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    data: data
  })
}


export function upload(data) {
  return request({
    url: '/senddocManage/upload',
    headers: { 'Content-Type': 'multipart/form-data' },
    method: 'post',
    data: data
  })
}

export function writeTitleByArticleId(data) {
  return request({
    url: '/senddocManage/writeTitleByArticleId',
    method: 'post',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    data: data
  })
}

// export function deleteFile(data) {
//   return request({
//     url: '/senddocManage/deleteFile',
//     headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
//     method: 'post',
//     data: data
//   })
// }

